﻿<%@ 
page language="java" 
import="java.util.*" 
import="com.csd.helper.IConstant"
import="com.csd.vo.UserVO"
import="com.csd.action.team.MemberAddAction"
pageEncoding="UTF-8"
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
HttpSession s = request.getSession();
UserVO uvo =  (UserVO)s.getAttribute(IConstant.userVO);
if(uvo==null || !uvo.getType().equals(IConstant.teamRole))
{
	response.sendRedirect(path);
}
String user_name = uvo.getName();

if(user_name == null)
{
	user_name = "暂无名称";
}

String projectTypeID=(String)request.getParameter("projectTypeID");
String teamID = (String)request.getParameter("teamID");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加组员</title>
<link href="css/student_right.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript" src="js/check.js"></script>
 <script type="text/javascript">
function getServerTime(){
  //因程序执行耗费时间,所以时间并不十分准确,误差大约在2000毫秒以下 
  var xmlHttp = false; 
  //获取服务器时间 
  try { 
    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); 
  } catch (e) { 
    try { 
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 
    } catch (e2) { 
      xmlHttp = false; 
    } 
  } 
    
  if (!xmlHttp && typeof XMLHttpRequest != 'undefined') { 
    xmlHttp = new XMLHttpRequest(); 
  } 
    
  xmlHttp.open("GET", "null.txt", false); 
  xmlHttp.setRequestHeader("Range", "bytes=-1"); 
  xmlHttp.send(null); 
  
  severtime=new Date(xmlHttp.getResponseHeader("Date")); 
  return severtime.getFullYear();
 }
 </script>
 <script type="text/javascript">
 function getGrade()
 {
	// get server current time
	var year = new String(getServerTime());
 	year = year.substr(year.length - 2, 2);
 	if (isNaN(year))
 		return;
 	
 	document.getElementById('grade1').innerHTML = ((year - 1 < 10) ? "0" + (year - 1) : year - 1) + "级";
 	document.getElementById('grade1').value=((year - 1 < 10) ? "0" + (year - 1) : year - 1);
 	document.getElementById('grade2').innerHTML = ((year - 2 < 10) ? "0" + (year - 2) : year - 2) + "级";
 	document.getElementById('grade2').value=((year - 2 < 10) ? "0" + (year - 2) : year - 2);
 	document.getElementById('grade3').innerHTML = ((year - 3 < 10) ? "0" + (year - 3) : year - 3) + "级";
 	document.getElementById('grade3').value=((year - 3 < 10) ? "0" + (year - 3) : year - 3);
 }
 </script>
  <script type="text/javascript">
 function checkMemberForm(form){	
 	var memberSno = document.getElementsByName('member.sno')[0];
	var memberName = document.getElementsByName('member.name')[0];
	var memberEmail = document.getElementsByName('member.email')[0];
	var memberTelephone = document.getElementsByName('member.telephone')[0];
	var memberMajor = document.getElementsByName('member.major')[0];
	var memberIntroduction = document.getElementsByName('member.introduction')[0];
	var flag=true;
	checkTelephone(memberTelephone);
	checkEmail(memberEmail);
	checkDigital(memberSno);
	checkFixedLength(memberSno);
	if(memberName.value == ""){
	checkNotNull(memberName);}else{
    isChinese(memberName);}
	checkNotNull(memberIntroduction);
	flag = checkForm(form);

	return flag;
}
		
function hintForLength(num){
var introduction = document.getElementsByName('member.introduction');
if(introduction[0].value.length >= num){
document.getElementById('error1').innerHTML = "最多输入"+num+"字介绍";
}else{
document.getElementById('error1').innerHTML = "";
}
}
 </script>
 
</head>

<body onload="getGrade();">
    <div class="main">
        <h1>添加新成员</h1>
        <hr />
        
        <form action="memberAdd.action" method="post" onsubmit="return checkMemberForm(this)">
        
        <table>
            <tr>
                <td class="form_strong" width="150px" >学号：</td>
                <td><input name="member.sno" type="text"  maxlength="10" 
                onblur="checkDigital(this);checkFixedLength(this);"
                onkeyup="checkDigital(this);checkFixedLength(this);" /></td>
            </tr>
            <tr>
                <td class="form_strong">姓名(0-20字)：</td>
                <td><input name="member.name" type="text" maxlength="20" onblur="checkNotNull(this);isChinese(this);" onkeyup="checkNotNull(this);isChinese(this)"/></td>
            </tr>
            <tr>
                <td class="form_strong">性别：</td>
                <td>
                <select name="member.gender">
                	<option value="true">男</option>
                	<option value="false">女</option>
                </select>
                </td>
            </tr>
            <tr>
                <td class="form_strong">电子邮箱：</td>
                <td><input name="member.email" type="text" maxlength="50" onblur="checkEmail(this);" /></td>
            </tr>
            <tr>
                <td class="form_strong">电话：</td>
                <td><input name="member.telephone" type="text" maxlength="15" onblur="checkTelephone(this);" /></td>
            </tr>
            <tr>
                <td class="form_strong">年级：</td>
                <td>
                <select name="member.grade">
                	<option id="grade1" value="1"></option>
                	<option id="grade2" value="2"></option>
                	<option id="grade3" value="3"></option>
                </select>
                </td>
            </tr>
            <tr>
                <td class="form_strong">专业方向：</td>
                <td>
                <select name="member.major" id="select"> 
                  <option  value="软件工程">软件工程</option> 
                  <option  value="信息安全">信息安全</option> 
                  <option  value="数字娱乐">数字娱乐</option> 
                </select>  
            </td> 
                
            </tr>
            <tr>
                <td class="form_strong">个人介绍：</td>
                <td><textarea cols="50" rows="10" name="member.introduction" 
                onblur="checkNotNull(this);" 
                onkeyup="checkNotNull(this);hintForLength(200);checkTextAreaLength(this,0,200);"
                onkeydown="checkTextAreaLength(this, 0, 200);"></textarea></td>
            </tr>
            <tr>
            <td  class="form_strong" colspan="2" align="center">
            <span id="error1" style="text-align:center; color:#FF0000;"></span>
            </td>
            </tr>
            <tr>
                <td align="center" colspan=2>   
                	<input type="hidden" value="<%=projectTypeID %>" name="projectTypeID" />  
                	<input type="hidden" value="<%=teamID %>" name="teamID"/>             
                    <input type="submit" value=" 完成 " />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="button" value=" 返回 " onclick="window.location.href('teamShow.action?projectTypeID=<%=projectTypeID%>')"/>
        </td>
            </tr>    
        </table>
         </form>



    </div>
</body>
</html>
